home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / lib / chess.g < prev    next >
Text File  |  1995-05-04  |  3KB  |  149 lines

  1. (game-module "chess"
  2.   (title "Xconq Chess")
  3.   (blurb "Xconq's answer to chess")
  4.   (instructions "This is more of an experiment than a real game."
  5.     "Move your pieces to try to capture the other player's king.")
  6.   )
  7.  
  8. (unit-type w-pawn)
  9. (unit-type w-rook)
  10. (unit-type w-knight)
  11. (unit-type w-bishop)
  12. (unit-type w-queen)
  13. (unit-type w-king)
  14.  
  15. (define w-types (w-pawn w-knight w-bishop  w-queen w-king))
  16.  
  17. (add w-types possible-sides "white")
  18.  
  19. (unit-type b-pawn)
  20. (unit-type b-rook)
  21. (unit-type b-knight)
  22. (unit-type b-bishop)
  23. (unit-type b-queen)
  24. (unit-type b-king)
  25.  
  26. (define b-types (b-pawn b-knight b-bishop  b-queen b-king))
  27.  
  28. (add b-types possible-sides "black")
  29.  
  30. ;(add u* assign-numbers false)
  31.  
  32. (terrain-type edge (color "gray"))
  33. (terrain-type row1 (color "red"))
  34. (terrain-type row2 (color "orange red"))
  35. (terrain-type row3 (color "orange"))
  36. (terrain-type row4 (color "yellow"))
  37. (terrain-type row5 (color "yellow green"))
  38. (terrain-type row6 (color "green"))
  39. (terrain-type row7 (color "turquoise"))
  40. (terrain-type row8 (color "blue"))
  41. (terrain-type row9 (color "violet"))
  42. (terrain-type row10 (color "purple"))
  43. (terrain-type row11 (color "purple4"))
  44.  
  45. ;;; Vision.
  46.  
  47. (set see-all true)
  48.  
  49. ;;; Actions.
  50.  
  51. (add (w-pawn b-pawn) acp-per-turn 1)
  52. (add (w-rook b-rook) acp-per-turn 13)
  53. (add (w-knight b-knight) acp-per-turn 2)
  54. (add (w-bishop b-bishop) acp-per-turn 13)
  55. (add (w-queen b-queen) acp-per-turn 13)
  56. (add (w-king b-king) acp-per-turn 1)
  57.  
  58. (add (w-pawn b-pawn) speed 10.00)
  59.  
  60. (add (w-pawn b-pawn) free-mp 0)
  61.  
  62. (table mp-to-enter-terrain
  63.   (u* t* 1)
  64.   (w-pawn t* (10 5 5 4 4 3 3 2 2 1 1 0))
  65.   (b-pawn t* (10 0 1 1 2 2 3 3 4 4 5 5))
  66.   )
  67.  
  68. (table mp-to-leave-terrain
  69.   (u* t* 0)
  70.   (w-pawn t* (10  5  6 6 7 7 8 8 9 9 10 10))
  71.   (b-pawn t* (10 10 10 9 9 8 8 7 7 6  6  5))
  72.   )
  73.  
  74. (table acp-to-attack (u* u* 1))
  75.  
  76. (table hit-chance (u* u* 100))
  77.  
  78. (table damage (u* u* 1))
  79.  
  80. ;;; Scoring.
  81.  
  82. (add u* point-value 0)
  83. (add (w-king b-king) point-value 1)
  84.  
  85. (scorekeeper 1 (do last-side-wins))
  86.  
  87. (area 15 13)
  88.  
  89. (area (terrain
  90.   (by-name
  91.     (edge 0) (row1 1) (row2 2) (row3 3) (row4 4)
  92.     (row5 5) (row6 6) (row7 7) (row8 8) (row9 9)
  93.     (row10 10) (row11 11))
  94.   "15a"
  95.   "a8l6a"
  96.   "a9k5a"
  97.   "a10j4a"
  98.   "a11i3a"
  99.   "a12h2a"
  100.   "a13ga"
  101.   "2a12fa"
  102.   "3a11ea"
  103.   "4a10da"
  104.   "5a9ca"
  105.   "6a8ba"
  106.   "15a"
  107. ))
  108.  
  109. (side 1 (name "White") (class "white"))
  110.  
  111. (side 2 (name "Black") (class "black"))
  112.  
  113. (w-pawn 5 2 1)
  114. (w-pawn 6 2 1)
  115. (w-pawn 7 2 1)
  116. (w-pawn 8 2 1)
  117. (w-pawn 9 2 1)
  118. (w-pawn 10 2 1)
  119. (w-pawn 11 2 1)
  120. (w-pawn 12 2 1)
  121. (w-pawn 13 2 1)
  122. (w-rook 6 1 1)
  123. (w-rook 13 1 1)
  124. (w-knight 7 1 1)
  125. (w-knight 12 1 1)
  126. (w-bishop 8 1 1)
  127. (w-bishop 11 1 1)
  128. (w-queen 9 1 1)
  129. (w-king 10 1 1)
  130.  
  131. (b-pawn 1 10 2)
  132. (b-pawn 2 10 2)
  133. (b-pawn 3 10 2)
  134. (b-pawn 4 10 2)
  135. (b-pawn 5 10 2)
  136. (b-pawn 6 10 2)
  137. (b-pawn 7 10 2)
  138. (b-pawn 8 10 2)
  139. (b-pawn 9 10 2)
  140. (b-rook 1 11 2)
  141. (b-rook 8 11 2)
  142. (b-knight 2 11 2)
  143. (b-knight 7 11 2)
  144. (b-bishop 3 11 2)
  145. (b-bishop 6 11 2)
  146. (b-queen 4 11 2)
  147. (b-king 5 11 2)
  148.  
  149.